package com.borrower.action;

import com.borrower.service.BorrowerServiceImpl;
import com.pojo.BorrowerBean;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * 将用户注销状态设置为1
 */
public class CancelAction extends Action{
    @Override
    public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        PrintWriter out = response.getWriter();
        String cancel = request.getParameter("isCancel");

        BorrowerBean bor = new BorrowerBean();
        bor.setIsCancel(cancel);

        HttpSession session = request.getSession();
        String loginName = String.valueOf(session.getAttribute("loginName"));

        BorrowerServiceImpl service = new BorrowerServiceImpl();
        if (service.CancelService(bor,loginName)){
            out.print("修改成功");
        }else {
            out.print("修改失败");
        }




    }
}
